package org.singledog.form.builder.parser.freemarker.parser;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.singledog.form.builder.ComponentType;
import org.singledog.form.builder.parser.freemarker.view.DataGridView;
import org.singledog.form.builder.view.View;

public class DataGridComponentParser extends AbstractFreemarkerParser {

    @Override
    public ComponentType supportType() {
        return ComponentType.datagrid;
    }

    @Override
    public View parseView(String code) {
        String schema = getSchema(code);
        JSONObject object = JSON.parseObject(schema);
        return new DataGridView(code, object);
    }
}
